package com.bd.module.returnos.ui;

import java.awt.Toolkit;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

public class ReturnedOSPanel extends JPanel {
	/** 获得当前屏幕分辨率宽度 */
	private double width = Toolkit.getDefaultToolkit().getScreenSize()
			.getWidth();
	/** 获得当前屏幕分辨率高度 */
	private double height = Toolkit.getDefaultToolkit().getScreenSize()
			.getHeight();
	/** button的高度 */
	private int btnHeight = 30;
	private int btnWidth = 180;
	private JButton button_3;
	private JButton button_4;
	private JButton button_5;
	private JButton button_6;
	private JButton button_7;
	public ReturnedOSPanel() {
		this.setBorder(new TitledBorder(null, "\u8FD4\u56DE\u754C\u9762",
				TitledBorder.CENTER, TitledBorder.TOP, null, null));

		this.setLayout(null);

		button_3 = new JButton("数据下载");
		button_3.setBounds((int) (this.width / 3 - 1),
				(int) (this.height / 4 - this.btnHeight), 93, this.btnHeight);
		this.add(button_3);

		button_4 = new JButton("数据上传");
		button_4.setBounds((int) (this.width / 3 - 1),
				(int) (this.height * 3 / 4 - this.btnHeight), 93,
				this.btnHeight);
		this.add(button_4);

		button_5 = new JButton("重新启动");
		button_5.setBounds((int) (this.width * 2 / 3 - 1),
				(int) (this.height / 4 - this.btnHeight), 93, this.btnHeight);
		this.add(button_5);

		button_6 = new JButton("用户注销");
		button_6.setBounds((int) (this.width * 2 / 3 - 1),
				(int) (this.height / 2 - this.btnHeight), 93, this.btnHeight);
		this.add(button_6);

		button_7 = new JButton("关闭系统");
		button_7.setBounds((int) (this.width * 2 / 3 - 1),(int) (this.height * 3 / 4 - this.btnHeight), 93,this.btnHeight);
		this.add(button_7);
		
		//监听键盘
		this.addKeyListener(new KeyMonitor());
	}
	
	private class KeyMonitor extends KeyAdapter{
		public void keyReleased(KeyEvent e) {
			//myTank.keyReleased(e);
		}

		public void keyPressed(KeyEvent e) {
			//myTank.keyPressed(e);
			if(e.getKeyCode() == KeyEvent.VK_F10){
				System.out.println("&&&&&&&&&&&&&&&&");
			}
		}
	}
}
